package com.antu.first.enums;

/**
 * Created by Administrator on 2018/3/13 0013.
 */
public enum UserStateEnum {
    REGISTER_SUCCESS(0, "用户信息注册成功！"),REGISTER_FAILED(-1, "用户信息注册失败"),EMPTY_INFO(-101, "用户信息为空！");

    private int state;

    private String stateInfo;

    UserStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {

        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }

    public static UserStateEnum valueOf(int key){
        for(UserStateEnum stateEnum : values()){
            if(stateEnum.getState() == key){
                return stateEnum;
            }
        }
        return null;
    }
}
